<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableCoupon extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('shop_id')->index()->nullable();
            $table->string('type');
            $table->string('title');
            $table->integer('price_limit')->default(0);
            $table->integer('money');
            $table->integer('shelf_life');
            $table->jsonb('applicable')->nullable();
            $table->integer('is_gift')->default(0);
            $table->integer('link_id')->default()->index();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupons');
    }
}
